﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;

public partial class ModifyPwd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    private Operation op = new Operation();

    //修改按钮
    protected void btnModify_Click(object sender, EventArgs e)
    {
        string uid = Session["User"].ToString();
        string oldpwd = tbOldPwd.Text;
        string newpwd = tbNewPwd.Text;
        if (tbNewPwd.Text != tbConfirm.Text)
        {
            Response.Write("<script language='javascript'>alert('两次输入密码不一致请重新输入！');</script>");
            tbConfirm.Text = "";
            tbNewPwd.Text = "";
            return;
        }
        else
        {
            if (op.ModifyPwd(uid, oldpwd, newpwd))
            {
                Response.Write("<script language='javascript'>alert('密码修改成功！');</script>");
            }
            else
            {
                Response.Write("<script language='javascript'>alert('旧密码输入错误，请重试！');</script>");
            }
        }
    }

    //取消按钮
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect(@"~\BrowserDatas.aspx");
    }
}